/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package sk.ke.szatmary.peter.jclac.simpleCiphers.core;

import sk.ke.szatmary.peter.jclac.simpleCiphers.SimpleCipherAttr;
import java.util.List;


/**
 *
 * @author nue
 */
public abstract class AbstractCipher {
    
    /**
     * list of atributes for cipher
     */
    protected List<SimpleCipherAttr> attrs;
    
    /**
     * prejde list atributov a vrati konretny podla typu, ak nenajde vrati null
     * @param list
     * @param type
     * @return 
     */
    protected Object getAtribute(List<SimpleCipherAttr> list, Class type) {
        for (SimpleCipherAttr attr : list) {
            if (attr.getValue().getClass().getSimpleName().equals(type.getSimpleName())) {
                return attr.getValue();
            }
        }
        return null;
    }
    

    /**
     * 
     * @return 
     */
    protected String getName() {
        return this.getClass().getSimpleName();
    }

    /**
     * 
     * @return 
     */
    protected List<SimpleCipherAttr> getAtrributes() {
        return this.attrs;
    }
    
    /**
     * 
     * @param list 
     */
    protected void setAtrributeList(List<SimpleCipherAttr> list) {
        this.attrs = list;
    }
    
    
    
    
}
